3.1072 \(\int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx\)

Optimal. Leaf size=116 \[ -\frac{a^2 (c-i d)^2 \tan (e+f x)}{f}-\frac{2 i a^2 (c-i d)^2 \log (\cos (e+f x))}{f}+2 a^2 x (c-i d)^2+\frac{c d (a+i a \tan (e+f x))^2}{f}-\frac{i d^2 (a+i a \tan (e+f x))^3}{3 a f} \]

[Out]

2*a^2*(c - I*d)^2*x - ((2*I)*a^2*(c - I*d)^2*Log[Cos[e + f*x]])/f - (a^2*(c - I*d)^2*Tan[e + f*x])/f + (c*d*(a
 + I*a*Tan[e + f*x])^2)/f - ((I/3)*d^2*(a + I*a*Tan[e + f*x])^3)/(a*f)

________________________________________________________________________________________

Rubi [A]  time = 0.165481, antiderivative size = 116, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 28, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.143, Rules used = {3543, 3527, 3477, 3475} \[ -\frac{a^2 (c-i d)^2 \tan (e+f x)}{f}-\frac{2 i a^2 (c-i d)^2 \log (\cos (e+f x))}{f}+2 a^2 x (c-i d)^2+\frac{c d (a+i a \tan (e+f x))^2}{f}-\frac{i d^2 (a+i a \tan (e+f x))^3}{3 a f} \]

Antiderivative was successfully verified.

[In]

Int[(a + I*a*Tan[e + f*x])^2*(c + d*Tan[e + f*x])^2,x]

[Out]

2*a^2*(c - I*d)^2*x - ((2*I)*a^2*(c - I*d)^2*Log[Cos[e + f*x]])/f - (a^2*(c - I*d)^2*Tan[e + f*x])/f + (c*d*(a
 + I*a*Tan[e + f*x])^2)/f - ((I/3)*d^2*(a + I*a*Tan[e + f*x])^3)/(a*f)

Rule 3543

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[
(d^2*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)), x] + Int[(a + b*Tan[e + f*x])^m*Simp[c^2 - d^2 + 2*c*d*Tan[e
 + f*x], x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] &&  !LeQ[m, -1] &&  !(EqQ[m, 2] && EqQ
[a, 0])

Rule 3527

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(d*
(a + b*Tan[e + f*x])^m)/(f*m), x] + Dist[(b*c + a*d)/b, Int[(a + b*Tan[e + f*x])^m, x], x] /; FreeQ[{a, b, c,
d, e, f, m}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] &&  !LtQ[m, 0]

Rule 3477

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^2, x_Symbol] :> Simp[(a^2 - b^2)*x, x] + (Dist[2*a*b, Int[Tan[c + d
*x], x], x] + Simp[(b^2*Tan[c + d*x])/d, x]) /; FreeQ[{a, b, c, d}, x]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx &=-\frac{i d^2 (a+i a \tan (e+f x))^3}{3 a f}+\int (a+i a \tan (e+f x))^2 \left (c^2-d^2+2 c d \tan (e+f x)\right ) \, dx\\ &=\frac{c d (a+i a \tan (e+f x))^2}{f}-\frac{i d^2 (a+i a \tan (e+f x))^3}{3 a f}+(c-i d)^2 \int (a+i a \tan (e+f x))^2 \, dx\\ &=2 a^2 (c-i d)^2 x-\frac{a^2 (c-i d)^2 \tan (e+f x)}{f}+\frac{c d (a+i a \tan (e+f x))^2}{f}-\frac{i d^2 (a+i a \tan (e+f x))^3}{3 a f}+\left (2 i a^2 (c-i d)^2\right ) \int \tan (e+f x) \, dx\\ &=2 a^2 (c-i d)^2 x-\frac{2 i a^2 (c-i d)^2 \log (\cos (e+f x))}{f}-\frac{a^2 (c-i d)^2 \tan (e+f x)}{f}+\frac{c d (a+i a \tan (e+f x))^2}{f}-\frac{i d^2 (a+i a \tan (e+f x))^3}{3 a f}\\ \end{align*}

Mathematica [B]  time = 4.22651, size = 261, normalized size = 2.25 \[ \frac{(a+i a \tan (e+f x))^2 \left (-\frac{1}{3} \left (3 c^2-12 i c d-7 d^2\right ) \sec (e) (\cos (2 e)-i \sin (2 e)) \sin (f x) \cos (e+f x)+4 f x (c-i d)^2 (\cos (2 e)-i \sin (2 e)) \cos ^2(e+f x)+(c-i d)^2 (-\sin (2 e)-i \cos (2 e)) \cos ^2(e+f x) \log \left (\cos ^2(e+f x)\right )-2 (c-i d)^2 (\cos (2 e)-i \sin (2 e)) \cos ^2(e+f x) \tan ^{-1}(\tan (3 e+f x))-\frac{1}{3} d (\cos (2 e)-i \sin (2 e)) (3 c+d \tan (e)-3 i d)-\frac{1}{3} d^2 \sec (e) (\cos (2 e)-i \sin (2 e)) \sin (f x) \sec (e+f x)\right )}{f (\cos (f x)+i \sin (f x))^2} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + I*a*Tan[e + f*x])^2*(c + d*Tan[e + f*x])^2,x]

[Out]

(((c - I*d)^2*Cos[e + f*x]^2*Log[Cos[e + f*x]^2]*((-I)*Cos[2*e] - Sin[2*e]) + 4*(c - I*d)^2*f*x*Cos[e + f*x]^2
*(Cos[2*e] - I*Sin[2*e]) - 2*(c - I*d)^2*ArcTan[Tan[3*e + f*x]]*Cos[e + f*x]^2*(Cos[2*e] - I*Sin[2*e]) - ((3*c
^2 - (12*I)*c*d - 7*d^2)*Cos[e + f*x]*Sec[e]*(Cos[2*e] - I*Sin[2*e])*Sin[f*x])/3 - (d^2*Sec[e]*Sec[e + f*x]*(C
os[2*e] - I*Sin[2*e])*Sin[f*x])/3 - (d*(Cos[2*e] - I*Sin[2*e])*(3*c - (3*I)*d + d*Tan[e]))/3)*(a + I*a*Tan[e +
 f*x])^2)/(f*(Cos[f*x] + I*Sin[f*x])^2)

________________________________________________________________________________________

Maple [B]  time = 0.006, size = 231, normalized size = 2. \begin{align*}{\frac{i{a}^{2} \left ( \tan \left ( fx+e \right ) \right ) ^{2}{d}^{2}}{f}}-{\frac{{a}^{2}{d}^{2} \left ( \tan \left ( fx+e \right ) \right ) ^{3}}{3\,f}}+{\frac{4\,i{a}^{2}cd\tan \left ( fx+e \right ) }{f}}-{\frac{{a}^{2} \left ( \tan \left ( fx+e \right ) \right ) ^{2}cd}{f}}-{\frac{{a}^{2}{c}^{2}\tan \left ( fx+e \right ) }{f}}+2\,{\frac{{a}^{2}\tan \left ( fx+e \right ){d}^{2}}{f}}+{\frac{i{a}^{2}\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ){c}^{2}}{f}}-{\frac{i{a}^{2}\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ){d}^{2}}{f}}+2\,{\frac{{a}^{2}\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) cd}{f}}-{\frac{4\,i{a}^{2}\arctan \left ( \tan \left ( fx+e \right ) \right ) cd}{f}}+2\,{\frac{{a}^{2}\arctan \left ( \tan \left ( fx+e \right ) \right ){c}^{2}}{f}}-2\,{\frac{{a}^{2}\arctan \left ( \tan \left ( fx+e \right ) \right ){d}^{2}}{f}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))^2*(c+d*tan(f*x+e))^2,x)

[Out]

I/f*a^2*tan(f*x+e)^2*d^2-1/3/f*a^2*d^2*tan(f*x+e)^3+4*I/f*a^2*c*d*tan(f*x+e)-1/f*a^2*tan(f*x+e)^2*c*d-a^2*c^2*
tan(f*x+e)/f+2/f*a^2*tan(f*x+e)*d^2+I/f*a^2*ln(1+tan(f*x+e)^2)*c^2-I/f*a^2*ln(1+tan(f*x+e)^2)*d^2+2/f*a^2*ln(1
+tan(f*x+e)^2)*c*d-4*I/f*a^2*arctan(tan(f*x+e))*c*d+2/f*a^2*arctan(tan(f*x+e))*c^2-2/f*a^2*arctan(tan(f*x+e))*
d^2

________________________________________________________________________________________

Maxima [A]  time = 1.53557, size = 194, normalized size = 1.67 \begin{align*} -\frac{a^{2} d^{2} \tan \left (f x + e\right )^{3} +{\left (3 \, a^{2} c d - 3 i \, a^{2} d^{2}\right )} \tan \left (f x + e\right )^{2} - 6 \,{\left (a^{2} c^{2} - 2 i \, a^{2} c d - a^{2} d^{2}\right )}{\left (f x + e\right )} - 3 \,{\left (i \, a^{2} c^{2} + 2 \, a^{2} c d - i \, a^{2} d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 3 \,{\left (a^{2} c^{2} - 4 i \, a^{2} c d - 2 \, a^{2} d^{2}\right )} \tan \left (f x + e\right )}{3 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2*(c+d*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

-1/3*(a^2*d^2*tan(f*x + e)^3 + (3*a^2*c*d - 3*I*a^2*d^2)*tan(f*x + e)^2 - 6*(a^2*c^2 - 2*I*a^2*c*d - a^2*d^2)*
(f*x + e) - 3*(I*a^2*c^2 + 2*a^2*c*d - I*a^2*d^2)*log(tan(f*x + e)^2 + 1) + 3*(a^2*c^2 - 4*I*a^2*c*d - 2*a^2*d
^2)*tan(f*x + e))/f

________________________________________________________________________________________

Fricas [B]  time = 1.65833, size = 713, normalized size = 6.15 \begin{align*} \frac{-6 i \, a^{2} c^{2} - 24 \, a^{2} c d + 14 i \, a^{2} d^{2} +{\left (-6 i \, a^{2} c^{2} - 36 \, a^{2} c d + 30 i \, a^{2} d^{2}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} +{\left (-12 i \, a^{2} c^{2} - 60 \, a^{2} c d + 36 i \, a^{2} d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )} +{\left (-6 i \, a^{2} c^{2} - 12 \, a^{2} c d + 6 i \, a^{2} d^{2} +{\left (-6 i \, a^{2} c^{2} - 12 \, a^{2} c d + 6 i \, a^{2} d^{2}\right )} e^{\left (6 i \, f x + 6 i \, e\right )} +{\left (-18 i \, a^{2} c^{2} - 36 \, a^{2} c d + 18 i \, a^{2} d^{2}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} +{\left (-18 i \, a^{2} c^{2} - 36 \, a^{2} c d + 18 i \, a^{2} d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )}{3 \,{\left (f e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2*(c+d*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

1/3*(-6*I*a^2*c^2 - 24*a^2*c*d + 14*I*a^2*d^2 + (-6*I*a^2*c^2 - 36*a^2*c*d + 30*I*a^2*d^2)*e^(4*I*f*x + 4*I*e)
 + (-12*I*a^2*c^2 - 60*a^2*c*d + 36*I*a^2*d^2)*e^(2*I*f*x + 2*I*e) + (-6*I*a^2*c^2 - 12*a^2*c*d + 6*I*a^2*d^2
+ (-6*I*a^2*c^2 - 12*a^2*c*d + 6*I*a^2*d^2)*e^(6*I*f*x + 6*I*e) + (-18*I*a^2*c^2 - 36*a^2*c*d + 18*I*a^2*d^2)*
e^(4*I*f*x + 4*I*e) + (-18*I*a^2*c^2 - 36*a^2*c*d + 18*I*a^2*d^2)*e^(2*I*f*x + 2*I*e))*log(e^(2*I*f*x + 2*I*e)
 + 1))/(f*e^(6*I*f*x + 6*I*e) + 3*f*e^(4*I*f*x + 4*I*e) + 3*f*e^(2*I*f*x + 2*I*e) + f)

________________________________________________________________________________________

Sympy [B]  time = 8.41448, size = 223, normalized size = 1.92 \begin{align*} \frac{2 a^{2} \left (- i c^{2} - 2 c d + i d^{2}\right ) \log{\left (e^{2 i f x} + e^{- 2 i e} \right )}}{f} + \frac{- \frac{\left (2 i a^{2} c^{2} + 12 a^{2} c d - 10 i a^{2} d^{2}\right ) e^{- 2 i e} e^{4 i f x}}{f} - \frac{\left (4 i a^{2} c^{2} + 20 a^{2} c d - 12 i a^{2} d^{2}\right ) e^{- 4 i e} e^{2 i f x}}{f} - \frac{\left (6 i a^{2} c^{2} + 24 a^{2} c d - 14 i a^{2} d^{2}\right ) e^{- 6 i e}}{3 f}}{e^{6 i f x} + 3 e^{- 2 i e} e^{4 i f x} + 3 e^{- 4 i e} e^{2 i f x} + e^{- 6 i e}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))**2*(c+d*tan(f*x+e))**2,x)

[Out]

2*a**2*(-I*c**2 - 2*c*d + I*d**2)*log(exp(2*I*f*x) + exp(-2*I*e))/f + (-(2*I*a**2*c**2 + 12*a**2*c*d - 10*I*a*
*2*d**2)*exp(-2*I*e)*exp(4*I*f*x)/f - (4*I*a**2*c**2 + 20*a**2*c*d - 12*I*a**2*d**2)*exp(-4*I*e)*exp(2*I*f*x)/
f - (6*I*a**2*c**2 + 24*a**2*c*d - 14*I*a**2*d**2)*exp(-6*I*e)/(3*f))/(exp(6*I*f*x) + 3*exp(-2*I*e)*exp(4*I*f*
x) + 3*exp(-4*I*e)*exp(2*I*f*x) + exp(-6*I*e))

________________________________________________________________________________________

Giac [B]  time = 1.64984, size = 691, normalized size = 5.96 \begin{align*} \frac{-6 i \, a^{2} c^{2} e^{\left (6 i \, f x + 6 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 12 \, a^{2} c d e^{\left (6 i \, f x + 6 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 6 i \, a^{2} d^{2} e^{\left (6 i \, f x + 6 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 18 i \, a^{2} c^{2} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 36 \, a^{2} c d e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 18 i \, a^{2} d^{2} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 18 i \, a^{2} c^{2} e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 36 \, a^{2} c d e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 18 i \, a^{2} d^{2} e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 6 i \, a^{2} c^{2} e^{\left (4 i \, f x + 4 i \, e\right )} - 36 \, a^{2} c d e^{\left (4 i \, f x + 4 i \, e\right )} + 30 i \, a^{2} d^{2} e^{\left (4 i \, f x + 4 i \, e\right )} - 12 i \, a^{2} c^{2} e^{\left (2 i \, f x + 2 i \, e\right )} - 60 \, a^{2} c d e^{\left (2 i \, f x + 2 i \, e\right )} + 36 i \, a^{2} d^{2} e^{\left (2 i \, f x + 2 i \, e\right )} - 6 i \, a^{2} c^{2} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 12 \, a^{2} c d \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 6 i \, a^{2} d^{2} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 6 i \, a^{2} c^{2} - 24 \, a^{2} c d + 14 i \, a^{2} d^{2}}{3 \,{\left (f e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2*(c+d*tan(f*x+e))^2,x, algorithm="giac")

[Out]

1/3*(-6*I*a^2*c^2*e^(6*I*f*x + 6*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) - 12*a^2*c*d*e^(6*I*f*x + 6*I*e)*log(e^(2*I
*f*x + 2*I*e) + 1) + 6*I*a^2*d^2*e^(6*I*f*x + 6*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) - 18*I*a^2*c^2*e^(4*I*f*x +
4*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) - 36*a^2*c*d*e^(4*I*f*x + 4*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 18*I*a^2*d
^2*e^(4*I*f*x + 4*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) - 18*I*a^2*c^2*e^(2*I*f*x + 2*I*e)*log(e^(2*I*f*x + 2*I*e)
 + 1) - 36*a^2*c*d*e^(2*I*f*x + 2*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 18*I*a^2*d^2*e^(2*I*f*x + 2*I*e)*log(e^(
2*I*f*x + 2*I*e) + 1) - 6*I*a^2*c^2*e^(4*I*f*x + 4*I*e) - 36*a^2*c*d*e^(4*I*f*x + 4*I*e) + 30*I*a^2*d^2*e^(4*I
*f*x + 4*I*e) - 12*I*a^2*c^2*e^(2*I*f*x + 2*I*e) - 60*a^2*c*d*e^(2*I*f*x + 2*I*e) + 36*I*a^2*d^2*e^(2*I*f*x +
2*I*e) - 6*I*a^2*c^2*log(e^(2*I*f*x + 2*I*e) + 1) - 12*a^2*c*d*log(e^(2*I*f*x + 2*I*e) + 1) + 6*I*a^2*d^2*log(
e^(2*I*f*x + 2*I*e) + 1) - 6*I*a^2*c^2 - 24*a^2*c*d + 14*I*a^2*d^2)/(f*e^(6*I*f*x + 6*I*e) + 3*f*e^(4*I*f*x +
4*I*e) + 3*f*e^(2*I*f*x + 2*I*e) + f)